<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
<div id="app">
    <!--v-bind:style 的对象语法十分直观——看着非常像 CSS，但其实是一个 JavaScript 对象-->
    <div :style="styleObj">动态绑定style对象语法</div>
    <div :style="{width:100+'%',height:50+'px',backgroundColor:'red',marginTop:10+'px'}">动态绑定style对象语法</div>
</div>
<script src="../../javascript/vue.js"></script>
<script>
    const vm = new Vue({
        el: "#app",
        data() {
            return {
                styleObj: {
                    width: 100 + "%",
                    height: 50 + "px",
                    backgroundColor: "red"
                }
            }
        }
    })
</script>
</body>

</html>